'''
Created on May 31, 2012

@author: mupet
'''
from syslogd.Utils import Utils
from syslogd.log.Filter import Filters

from syslogd.status.ServiceController import ServiceController
from syslogd.status.Status import Status
from threading import Thread
import time
from syslogd.gui.LogHolder import LogHolder

class LogReader(object):
    '''
    classdocs
    '''
    
    class LogGetter(Thread):
        
        def __init__(self, fifo):
            Thread.__init__(self)
            self.fifo=fifo
        
        def run(self):
            while 1:
                line = self.fifo.readline()
                if line != '':
                    LogHolder.storeLogLine(line)
                    pass
                    LogReader.filters.determineLog(line.strip())
                else:
                    time.sleep(1)
                
    
    filters = Filters()


    def __init__(self, fifo):
        '''
        Constructor
        '''
        self.LogGetter(fifo).start()
        
    @staticmethod
    def getFilters():
        return LogReader.filters